package com.viknix.threadpool.manager.config.convert;

import com.viknix.threadpool.manager.common.model.PoolParameterInfo;
import com.viknix.threadpool.manager.repository.entity.ThreadPoolInfoEntity;
import org.mapstruct.Mapper;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.factory.Mappers;

/**
 * @Author: Dongqi
 * @Date: 2021/10/29 13:42
 * @Version 1.0
 * @Description:
 */
@Mapper(componentModel = "spring", nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
public interface ThreadPoolInfoConvert {

    ThreadPoolInfoConvert INSTANCE = Mappers.getMapper(ThreadPoolInfoConvert.class);

    /**
     * ThreadPoolInfoEntity 转为 PoolParameterInfo
     * @param entity 数据库对应实体类
     * @return PoolParameterInfo
     */
    PoolParameterInfo convert(ThreadPoolInfoEntity entity);

    /**
     * PoolParameterInfo 转为 ThreadPoolInfoEntity
     * @param parameterInfo parameterInfo
     * @return 数据库对应实体类
     */
    ThreadPoolInfoEntity convert(PoolParameterInfo parameterInfo);
}
